<template>
  <div class="boxs">
    <crumbs :BreadCrumb="BreadCrumb"></crumbs>
    <div>
      <div class="titles">航班查询-预订机票</div>
      <el-form :inline="true" :model="formInline" class="demo-form-inline">
        <el-form-item label="航程类型">
          <el-radio-group v-model="type1">
            <el-radio label="1">单程</el-radio>
            <el-radio label="2">往返-组合</el-radio>
            <el-radio label="3">往返-自由搭配</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="出发城市" label-width="70px">
          <el-select clearable v-model="cityName" placeholder="请选择">
            <el-option-group
              v-for="group in cityList"
              :key="group.index"
              :label="group.name"
            >
              <el-option
                v-for="item in group.cityNameLists"
                :key="item.index"
                :label="item.cityName"
                :value="item.cityName"
              >
              </el-option>
            </el-option-group>
          </el-select>
        </el-form-item>
        <el-form-item label="到达城市" label-width="70px">
          <el-select clearable v-model="cityName1" placeholder="请选择">
            <el-option-group
              v-for="group in cityList1"
              :key="group.index"
              :label="group.name"
            >
              <el-option
                v-for="item in group.cityNameLists"
                :key="item.index"
                :label="item.cityName"
                :value="item.cityName"
              >
              </el-option>
            </el-option-group>
          </el-select>
        </el-form-item>
        <el-form-item label="出发日期" label-width="70px">
          <el-date-picker
            v-model="date1"
            type="date"
            format="yyyy 年 MM 月 dd 日"
            value-format="yyyy-MM-dd"
            placeholder="选择日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="到达日期" label-width="70px">
          <el-date-picker
            v-model="date2"
            type="date"
            format="yyyy 年 MM 月 dd 日"
            value-format="yyyy-MM-dd"
            placeholder="选择日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="出发日期" label-width="70px">
          <el-checkbox v-model="children"
            >是否携带儿童(可查询儿童特价)</el-checkbox
          >
        </el-form-item>
        <el-form-item label="计划机型" label-width="70px">
          <el-select clearable v-model="label" placeholder="请选择">
            <el-option
              v-for="item in typeList"
              :key="item.index"
              :label="item.type"
              :value="item.type"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="航空公司" label-width="70px">
          <el-select clearable v-model="airliner" placeholder="请选择">
            <el-option
              v-for="item in airlinerList"
              :key="item.id"
              :label="item.airlinerShorter"
              :value="item.airlinerShorter"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="舱位等级" label-width="70px">
          <el-select clearable v-model="value" placeholder="不限舱位">
            <el-option
              v-for="item in cabinList"
              :key="item.index"
              :label="item"
              :value="item"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="排序方式">
          <el-radio-group v-model="formInline.resource">
            <el-radio label="起飞时间从早到晚"></el-radio>
            <el-radio label="起飞时间从晚到早"></el-radio>
            <el-radio label="舱位价格从低到高"></el-radio>
            <el-radio label="舱位价格从高到低"></el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="search">搜索</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
export default {
  name: "query",
  components: {},
  props: {
    // searchs: String,
  },
  data() {
    return {
      BreadCrumb:[
        { path: "/flight/query", name: "机票查询" },
        { path: "/flight/flightlist", name: "机票列表" },
      ],
      show: false,
      cabinList: ["不限舱位", "经济舱", "公务舱/头等舱"],
      // cabinList:[
      //   {
      //     id:0,
      //     names:'不限舱位',
      //     is:true
      //   },
      //   {
      //     id:1,
      //     names:'经济舱',
      //     is:false
      //   },
      //   {
      //     id:2,
      //     names:'公务舱/头等舱',
      //     is:false
      //   }
      // ],
      type1: 1,
      checkList: [],
      // 出发日期
      value1: "",
      value2: "",
      // 出发城市
      cityName: "",
      cityName1: "",
      date1: "",
      date2: "",
      formInline: {},
      checked: true,
      // 航空公司
      airlinerList: [],
      airliner:'',
      options: [],
      value: "",
      optionsed: [],
      type: [],
      label: "",
      typeList: [
        {
          id: "大",
          type: "大机型",
          is: false,
        },
        {
          id: "中",
          type: "中机型",
          is: false,
        },
        {
          id: "小",
          type: "小机型",
          is: false,
        },
      ],
      cityList: [],
      cityList1: [],
      journeyactive: 0,
      children: false,
      // 单程
      oneway: [
        {
          id: 0,
          cwcity: "北京",
          ddcity: "上海",
          gotime: "",
          ddtime: "",
          goweekday: "今天",
          ddweekday: "今天",
        },
      ],

      GoSearchWhere: {},
    };
  },
  methods: {
    
    // formInline() {

    // },
    
    // 搜索
    
    // 机票查询
    // 机票查询
    // getFlightInfoList() {
    //   let list = this.data.GoSearchWhere
    //   let GoSearchWheres = {
    //     // 仓位
    //     Cabin:list.shipping,
    //     DepDate:this.data.singleTime,
    //     DstAirport:list.listinfo.ddcity,
    //     OrgAirport:list.cwcity,
    //   }
    //   wx.showLoading({
    //     title: '加载中',
    //     mask:true
    //   })
    //   api.getFlightInfoList({
    //     GoSearchWhere: GoSearchWheres,
    //     // hasKeyCustomers: this.data.hasKeyCustomers,
    //     hasKeyCustomers: false,
    //     // IsNoCache: this.data.IsNoCache,
    //     TripType: this.data.TripType,
    //   }).then(res => {
    //     wx.hideLoading()
    //     if (res.code == '200') {
    //       console.log(res)
    //       let flightVos = res.data[0].flightVos
    //       let list = JSON.stringify(flightVos)
    //       // 时段显示的最低价格数据源
    //       let type = 0
    //       this.seltimeframeprice(this.bindshippingtype(flightVos,type))
    //       // 获取航空公司
    //       let airlineList = []
    //       let arr = []
    //       flightVos.map(item=>{
    //         arr.push(item.airline)
    //       })
    //       let arr1 = []
    //       // // //console.log(arr)
    //       for(let i=0;i<arr.length;i++){
    //         for(let j=i+1;j<arr.length;j++){
    //           if(arr[i]==arr[j]){
    //             j=++i
    //           }
    //         }
    //         arr1.push(arr[i])
    //       }
    //       for(let z=0;z<arr1.length;z++){
    //         let obj = {
    //           id:z,
    //           airline:arr1[z],
    //           is:false,
    //         }
    //         airlineList.push(obj)
    //       }
    //       let GoSearchWhere = this.GoSearchWhere
    //       GoSearchWhere.listinfo.gotime = this.data.singleTime
    //       // this.setData({
    //       //   GoSearchWhere,
    //       //   airlineList:airlineList,
    //       //   flightVos: this.screen(flightVos,0),
    //       //   flightVoss:JSON.parse(list)

    //       // })
    //       // 航班中转
    //       // let flightTransfers = res.data[0].flightTransfers
    //       // let lists = JSON.stringify(flightTransfers)
    //       // if(flightTransfers.length>0){
    //       //   this.setData({
    //       //     flightTransfers:this.transit(flightTransfers),
    //       //     flightTransferss:JSON.parse(lists)
    //       //   })
    //       //   console.log(this.flightTransfers)
    //       // }
    //     }
    //   })
    // },
    // 选择城市
    getCityList() {
      this.$axios.getCityList().then((res) => {
        console.log(res);
        if (res.code == "200") {
          let arr = [];
          let row = res.data;
          // for(let i =0;i<row.length;i++){
          //   arr.push(row[i].letter)
          // }
          // console.log(res.data)
          this.cityList = res.data;
          this.cityList1 = res.data;
        }
      });
    },
  },
  mounted() {
    this.getflightlist();
    this.getCityList()
  },
};
</script>

<style scoped>
.boxs {
    width: 650px;
    margin: 50px auto;
    /* margin: 50px 0 0 173px; */
  }
</style>